/*
 * Copyright (C) 2015-2016  Nicola Spanti (RyDroid) <dev@nicola-spanti.info>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */


#ifndef PLANET_WARS_2D_RT_CORE_MODEL_GAME_PLAYERS_H
#define PLANET_WARS_2D_RT_CORE_MODEL_GAME_PLAYERS_H


#include "PlanetWars2dRT-core/specific/model/game_essential.h"


EXTERN_C_BEGIN


static inline
unsigned char
game_get_nb_players(const game_t* game)
{
  return
    (unsigned char)
    VECTOR_GENERIC_STATIC_GET_SIZE_UNSAFE(&game->players);
}

static inline
const player_t*
game_get_const_player_no_check(const game_t* game, unsigned char index)
{
  return VECTOR_GENERIC_STATIC_GET_ITEM_POINTER_UNSAFE(&game->players,
						       index);
}

static inline
player_t*
game_get_player_no_check(game_t* game, unsigned char index)
{
  return VECTOR_GENERIC_STATIC_GET_ITEM_POINTER_UNSAFE(&game->players,
						       index);
}

bool
game_add_player(game_t* game, const player_t* player_to_add);

unsigned char
game_get_player_index_of_player(const game_t* game, const player_t* player);

void
game_remove_players(game_t* game);


EXTERN_C_END


#endif
